<template>
  <div class="home">
    <my-header>
      <!-- v-slot 简写形式# -->
       <template #left>
          返回
       </template>
       <template #center>
          商品列表
       </template>
       <template #right>
          编辑
       </template>
    </my-header>
    <!-- /about?id=3&num=4 -->
    <button @click="$router.push({path:'/about',query:{id:3,num:4}})">跳转</button>
  </div>
</template>

<script>
import MyHeader from '@/components/myHeader.vue'
// @ is an alias to /src
import { onBeforeRouteLeave } from 'vue-router';
export default {
  name: 'Home',
  components: {
    MyHeader
  },
  setup(props) {
    onBeforeRouteLeave((to,from) => {
       console.log(to);
       console.log(from);
       return false
    })
  }
}
</script>
<style lang="scss" scoped>
   .home{
     height: 100%;
     background: #e9e9e9;
   }
</style>
